
function exportExcel(set_tid){
    if(!set_tid){
        Ext.Msg.alert('错误',"系统模块ID不正确！无法导出报表！");
        return;
    }
    var eWindow = new Ext.Window({
        title:"数据导出",
        width:294,
        height:330
    });
    
    //导出表格
    var ExportExcel = function(){
        var r = eGridPanel.getSelectionModel().getSelections();
        var s = [];
        Ext.each(r,function(a,b){
            s.push(a.get('id'));
        });
        s.join('|');
        //下面两行是把高级搜索的窗口渲染一下，要不然获取不到值 
        Ext.getCmp('advSearchwin').show();
        Ext.getCmp('advSearchwin').hide();
        var searchobj=Ext.getCmp('advSearchForm').getForm().getValues(false);
        Ext.Ajax.request({
            url:'/export.php?op=saveParam',
            params:searchobj,
            success:function(){
                window.open('/export.php?tid='+set_tid+'&fields='+s);
            }
        });
    }
    
    //导出窗口
    var eGridPanel = new Ext.grid.GridPanel({
        height:300,
        title:"请选择导出字段",
        store:new Ext.data.JsonStore({
            autoLoad:true,
            url:'/gl/readConfig_and_Data/getCombo.php?table=fld&con[tid]='+set_tid,
            root:'data',
            fields:['id','field','name'],
            listeners :{
                load:function(){
                    eGridPanel.getSelectionModel().selectAll();
                }
            }
        }),
        cm:new Ext.grid.ColumnModel([
            new Ext.grid.CheckboxSelectionModel(),
            {
                header:'field',
                dataIndex:'field',
                hidden:true
            },

            {
                header:'字段',
                dataIndex:'name',
                width:200,
                sortable:false
            }
            ]),
        sm:new Ext.grid.CheckboxSelectionModel(),
        bbar:[
        {
            text:'导出选中',
            pressed:true,
            handler:ExportExcel
        }
        ]
    })
    eWindow.add(eGridPanel);
    eWindow.show();
}